***** Replication code for Franchino, Fabio, and Camilla Mariotto. “Noncompliance Risk, Asymmetric Power and the Design of Enforcement of the European Economic Governance”. European Union Politics.

***** Online Appendix Section 3.6 Secondary issue category assignment
*** Table A9: Governmental positions on national discretion and enforcement regimes: secondary issue category assignment
version 15
pause on
use conflict_data_FC2.dta, clear

*** Code primary and secondary dimension
gen dim_d_nat=1 if discr_nat!=.
gen dim_d_cou=1 if discr_cou!=.
gen dim_d_com=1 if discr_com!=.
label variable dim_d_nat "Primary (1) or secondary (2) dimention"
label variable dim_d_cou "Primary (1) or secondary (2) dimention"
label variable dim_d_com "Primary (1) or secondary (2) dimention"
label define dimention 1 "primary" 2 "secondary"
label values dim_d_nat dimention
label values dim_d_cou dimention
label values dim_d_com dimention
order discr_nat dim_d_nat, after(tighten)
order discr_cou dim_d_cou, after(constr_cou)
order discr_com dim_d_com, after(constr_com)

* Issue 1 - added National Discretion (switched)
replace dim_d_nat=2 if issue_id==1
replace discr_nat=discr_com if issue_id==1
recode discr_nat (1 = 3) (3 = 1) if issue_id==1
* list country discr_nat dim_d_nat discr_com dim_d_com if issue_id==1

* Issue 2 - not relevant

* Issue 3 - added National Discretion 
replace dim_d_nat=2 if issue_id==3
replace discr_nat=discr_cou if issue_id==3
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==3

* Issue 4 - added National Discretion
replace dim_d_nat=2 if issue_id==4
replace discr_nat=discr_cou if issue_id==4
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==4

* Issue 5 - added Council Discretion (switched)
replace dim_d_cou=2 if issue_id==5
replace discr_cou=discr_com if issue_id==5
recode discr_cou (1 = 3) (3 = 1) if issue_id==5
* list country discr_cou dim_d_cou discr_com dim_d_com if issue_id==5

* Issue 6 - added National Discretion
replace dim_d_nat=2 if issue_id==6
replace discr_nat=discr_cou if issue_id==6
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==6

* Issue 7 - added National Discretion
replace dim_d_nat=2 if issue_id==7
replace discr_nat=discr_cou if issue_id==7
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==7

* Issue 8 - added Council Discretion (switched)
replace dim_d_cou=2 if issue_id==8
replace discr_cou=discr_com if issue_id==8
recode discr_cou (1 = 3) (3 = 1) if issue_id==8
* list country discr_cou dim_d_cou discr_com dim_d_com if issue_id==8

* Issue 9 - added National Discretion
replace dim_d_nat=2 if issue_id==9
replace discr_nat=discr_cou if issue_id==9
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==9

* Issue 10 - no secondary dimention

* Issue 11 - added National Discretion
replace dim_d_nat=2 if issue_id==11
replace discr_nat=discr_cou if issue_id==11
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==11

* Issue 12 -  not relevant

* Issue 13 - added Council Discretion (switched)
replace dim_d_cou=2 if issue_id==13
replace discr_cou=discr_com if issue_id==13
recode discr_cou (1 = 3) (3 = 1) if issue_id==13
* list country discr_cou dim_d_cou discr_com dim_d_com if issue_id==13

* Issue 14 - added National Discretion
replace dim_d_nat=2 if issue_id==14
replace discr_nat=discr_cou if issue_id==14
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==14

* Issue 15 - added Commission Discretion (switched)
replace dim_d_com=2 if issue_id==15
replace discr_com=discr_nat if issue_id==15
recode discr_com (1 = 3) (3 = 1) if issue_id==15
* list country discr_com dim_d_com discr_nat dim_d_nat if issue_id==15

* Issue 16 - 29  not relevant

* Issue 30 - no secondary dimention

* Issue 31 - added Commission Discretion (switched)
replace dim_d_com=2 if issue_id==31
replace discr_com=discr_cou if issue_id==31
recode discr_com (1 = 3) (3 = 1) if issue_id==31
* list country discr_com dim_d_com discr_cou dim_d_cou if issue_id==31

* Issue 31 - added National Discretion
replace dim_d_nat=2 if issue_id==31
replace discr_nat=discr_cou if issue_id==31
* list country discr_nat dim_d_nat discr_cou dim_d_cou if issue_id==31

* Issue 32 - 35  not relevant

* Issue 36 - added Council Discretion (switched)
replace dim_d_cou=2 if issue_id==36
replace discr_cou=discr_com if issue_id==36
recode discr_cou (1 = 3) (3 = 1) if issue_id==36
* list country discr_cou dim_d_cou discr_com dim_d_com if issue_id==36

* Issue 37 - no secondary dimention
* Issue 38 - no secondary dimention
* Issue 39 - no secondary dimention
* Issue 40 - no secondary dimention

* Sources
* https://stats.stackexchange.com/questions/168793/seeming-unrelated-regression-sur-for-logistic-regression
* https://www.stata.com/statalist/archive/2006-10/msg00842.html
* https://mc-stan.org/docs/2_18/stan-users-guide/multivariate-outcomes.html
* https://www.stata.com/statalist/archive/2004-05/msg00759.html
* https://www.theanalysisfactor.com/link-functions-and-errors-in-logistic-regression/
* Multilevel model STATA video https://www.youtube.com/watch?v=ZI8d1EPeIvU

*** Table A9: Governmental positions on national discretion and enforcement regimes: secondary issue category assignment
* Generalized structural equation model: Three-levels, Random intercepts
gsem (discr_com <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
	 (discr_cou <- c.debt_gdp c.nbi c.nbi#c.debt_gdp i.eurozone i.crisis@0 i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ) ///
     (discr_nat <- c.debt_gdp                        i.eurozone i.crisis   i.cou_pres c.gov_lr c.gov_eu c.goodEU_net_6 i.comm_s M1[act] M2[act>issue_id], ologit ), vce(robust) nolog


